/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.edu.kamai.xmlparser.speaking;

import com.edu.kamai.xml.beans.paperXML;
import com.edu.kamai.xml.beans.speaking.speakingQuestion;
import com.edu.kamai.xml.beans.speaking.speakingXML;
import com.edu.kamai.xmlparser.paperGeneration;
import org.jdom.Document;
import org.jdom.Element;

/**
 *
 * @author xyzhu
 */
public class speakingPaperGeneration extends paperGeneration {
    public speakingPaperGeneration(paperXML xml){
        //super();
        super(xml.getPaperRoleID());
        this.wxml = (speakingXML) xml;
    }
    
    public void generateBody(){
        document = new Document();
        Element root = generateHead();
        int numOfQuestion = wxml.getSpeakingquestionList().size();
        for(int i = 0;i < numOfQuestion; i++){
            speakingQuestion sq = wxml.getSpeakingquestionList().get(i);
            Element child = new Element("speakingQestion");
            child.addContent(new Element("paperTitle").setText(sq.getPaperTitle()));
            child.addContent(new Element("readingTimeLimit").setText(sq.getReadingTime()));
            child.addContent(new Element("prepareTimeLimit").setText(sq.getPrepareTime()));
            child.addContent(new Element("mp3Path").setText(sq.getMp3Path()));
            child.addContent(new Element("MainTxt").setText(sq.getMainTxt()));
            root.addContent(child);
        }
        document.setContent(root);
    }
    
    private speakingXML wxml;
    
}
